package esempi;

import java.util.*;

public class PilaStackSet {

	public static void main(String[] args) {
		LinkedList<Integer> stack = new LinkedList<>();
		stack.addLast(2);
		stack.addLast(5);
		stack.addLast(3);
		while (!stack.isEmpty()) {
			int x = stack.removeLast();

		}

		Collections.sort(stack);
		Collections.binarySearch(stack, 2);
		ArrayList<String> ls = new ArrayList<>();
		ls.add("zaino");
		ls.add("abaco");
		ls.add("casa");
		ls.add("lupo");
		ls.add("il");
		Collections.sort(ls, new MioComparatore());
		System.out.println(ls);
		List<String> ls1 = Arrays.asList("casa", "gas", "fuoco");
		System.out.println(ls1);

		HashSet<Integer> s1 = new HashSet<>();
		s1.add(2);
		s1.add(5);
		s1.add(2);
		s1.add(5);
		s1.add(5);
		s1.add(3);
		System.out.println(s1);
		HashSet<Integer> s2 = new HashSet<>(Arrays.asList(5, 3, 4, 2, 1, 2));
		System.out.println(s2);
		HashSet<Integer> s3 = new HashSet<>(s1);// s3 e s4 sono copie per non
												// modificare s1.
		HashSet<Integer> s4 = new HashSet<>(s1);
		s3.removeAll(s4);
		HashSet<Integer> s5 = new HashSet<>(s1);
		HashSet<Integer> s6 = new HashSet<>(s1);
		s6.removeAll(s5);
		HashSet<Integer> s7 = new HashSet<>(s3);
		s7.addAll(s6);
		System.out.println(s7);

	}

}
